PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Appearance Manager >

Programming With the Appearance Manager


DrawThemeButton

Draws a button.

pascal OSStatus DrawThemeButton (
                     const Rect *inBounds,
                     ThemeButtonKind inKind,
                     const ThemeButtonDrawInfo *inNewInfo,
                     const ThemeButtonDrawInfo *inPrevInfo,
                     ThemeEraseUPP inEraseProc,
                     ThemeButtonDrawUPP inLabelProc,
                     UInt32 inUserData);
inBounds
A pointer to a structure of type Rect . Pass a rectangle specifying the boundary of the button, in local coordinates.
inKind
A value of type ThemeButtonKind . Pass a constant specifying the type of button to draw. See Theme Button Kind Constants for descriptions of possible values.
inNewInfo
A pointer to a structure of type ThemeButtonDrawInfo . Before calling DrawThemeButton , set the structure to contain the new state, value, and adornment for the button. DrawThemeButton uses the information passed in the inNewInfo and inPrevInfo parameters to apply transitional animation or sound effects as the button state changes, if such are specified under the current theme.
inPrevInfo
A pointer to a structure of type ThemeButtonDrawInfo . If the button state is changing, set the structure to contain the previous state, value, and adornment for the button, to allow DrawThemeButton to apply any transitional effects. If the button state is not changing, you can pass NULL .
inEraseProc
A value of type ThemeEraseUPP . If you have a custom background, pass a universal procedure pointer to an application-defined function such as that described in MyThemeEraseProc . DrawThemeButton calls that function to erase the background before drawing the button. If you pass NULL , no erasing occurs.
inLabelProc
A value of type ThemeButtonDrawUPP . If you pass a universal procedure pointer to an application-defined function such as that described in MyThemeButtonDrawProc , DrawThemeButton calls that function to draw the label of the button. If you pass NULL , no label is drawn.
inUserData
An unsigned 32-bit integer. Provide any data to be passed in to the callback functions specified in the inLabelProc and inEraseProc parameters. Pass NULL if you do not wish to provide any data.
function result
A result code; see Result Codes .
DISCUSSION

The DrawThemeButton function draws a theme-compliant button. If a ThemeEraseProcPtr is specified in the inEraseProc parameter, DrawThemeButton uses that function to erase the background of the button before drawing the button. After the button is drawn, if a ThemeButtonDrawProcPtr is specified in the inLabelProc parameter, DrawThemeButton calls that function to draw the button's label.

Note that DrawThemeButton also draws any appearance adornments for the button and that these can extend beyond the button's basic bounding rectangle, as specified in the inBounds parameter, and may be of variable shape. You may therefore wish to call the function GetThemeButtonBackgroundBounds to obtain the actual rectangle containing the pixels belonging to a button under the current theme.

VERSION NOTES

Available with Appearance Manager 1.1 and later.


© 1999 Apple Computer, Inc. – (Last Updated 29 April 99)